package org.jiucheng.magpiebridge.server.aio;

import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;

import org.jiucheng.magpiebridge.server.aio.proxy.ProxyEstablishmentAttachment;

/**
 * 
 * @author jiucheng
 *
 */
public class ServerWriteAttachment {

    private ByteBuffer writeBuffer;
    private ProxyEstablishmentAttachment proxyAttachment;
    private AsynchronousSocketChannel proxyAsynchronousSocketChannel;
    private int uri;
    private boolean connected;
    private ByteBuffer readByteBuffer;

    public ServerWriteAttachment(ByteBuffer writeBuffer, ProxyEstablishmentAttachment proxyAttachment) {
        this.writeBuffer = writeBuffer;
        this.proxyAttachment = proxyAttachment;
    }
    
    public ByteBuffer getWriteBuffer() {
        return writeBuffer;
    }
    
    public ServerWriteAttachment setWriteBuffer(ByteBuffer writeBuffer) {
        this.writeBuffer = writeBuffer;
        return this;
    }
    
    public ProxyEstablishmentAttachment getProxyAttachment() {
        return proxyAttachment;
    }
    
    public AsynchronousSocketChannel getProxyAsynchronousSocketChannel() {
        return proxyAsynchronousSocketChannel;
    }
    
    public ServerWriteAttachment setProxyAsynchronousSocketChannel(AsynchronousSocketChannel proxyAsynchronousSocketChannel) {
        this.proxyAsynchronousSocketChannel = proxyAsynchronousSocketChannel;
        return this;
    }
    
    public int getUri() {
        return uri;
    }
    
    public ServerWriteAttachment setUri(int uri) {
        this.uri = uri;
        return this;
    }
    
    public ByteBuffer getReadByteBuffer() {
        return readByteBuffer;
    }
    
    public ServerWriteAttachment setReadByteBuffer(ByteBuffer readByteBuffer) {
        this.readByteBuffer = readByteBuffer;
        return this;
    }

	public boolean isConnected() {
		return connected;
	}

	public ServerWriteAttachment setConnected(boolean connected) {
		this.connected = connected;
		return this;
	}
}
